<link rel="stylesheet" href="/css/map/detailgrid.css">
<?php $flgFirst=true ?>
<?php $flgLast=true ?>
<?php if (count($griddetail)>0): ?>

<table class="grid" cellpadding="0" cellspacing="0" style="width: 100%;">
        <tr  style="background-color: #e6e6d2; height: 50px">
        <th class="ovimage">
           
        </th>
        <th style="width: 200px">
            Overlay Title
        </th>
        <th style="width: 200px">
            Research Title
        </th>
        <th style="width: 200px">
            Citation
        </th>
        <th style="width: 70px">
            SW,NE
        </th>
        
        
    </tr>
<tbody style="overflow-x: hidden; overflow-y: auto; height: 410px;" id="gridtbody">
    <?php foreach($griddetail as $r): ?>
    <tr>
        <td >
            <img width="120px" height="100px" style="border:none; margin: 0px; padding: 0px" src="<?php echo url_for('map/Overlay_Image?overlayid='.$r->getId())?>"/>
        </td>
        <td style="text-align: left">
            <?php echo $r["overlaytitle"]; ?>
        </td>
        <td style="text-align: left">
            <?php echo $r->Research["title"]; ?>
        </td>
        <td style="text-align: left">
            <?php echo $r->Research["citation"]; ?>
        </td>
        <td>
            <?php echo "(".$r["slat"].",".$r["wlng"].")". " (".$r["nlat"].",".$r["elng"].")"; ?>
        </td>
        
        
     </tr>
<?php endforeach ?>
    
</tbody>
</table>

                    <?php if ($griddetail->haveToPaginate()): ?>
                    <div style="background-color: #e6e6d2; width: 100%; height: 25px; padding-left: 2px; padding-top: 2px; padding-bottom: 2px">
                    <?php $links = $griddetail->getLinks(); foreach ($links as $page): ?>
                        <?php if ($page==$griddetail->getFirstpage()): $flgFirst=false; endif ?>
                        <?php if ($page==$griddetail->getLastpage()): $flgLast=false; endif ?>
                    <?php endforeach ?>
                    <?php if ($griddetail->getPage()!=$griddetail->getFirstpage()):?>
                        <div class="pagination">
                            <a class="pgnumber" onclick="loadgridpage(<?php echo $griddetail->getPreviousPage() ?>,'OVERLAY')">Previous</a>
                        </div>
                    <?php endif ?>
                    <?php if ($flgFirst==true):?>
                        <div class="pagination">
                            <a class="pgnumber" onclick="loadgridpage(<?php echo $griddetail->getFirstPage()?>,'OVERLAY')"><?php echo$griddetail->getFirstPage()?></a>
                        </div>
                        <div class="pagination">
                            ..
                        </div>
                    <?php endif ?>


                    <?php $links = $griddetail->getLinks(); foreach ($links as $page): ?>
                        <div class="pagination">
                            <?php //echo ($page == $griddetail->getPage())// ? $page : link_to($page, 'bussiness/index?page='.$page) ?>
                            <?php if ($griddetail->getPage()==$page): ?>
                            <a class="pgnumberactive" onclick="loadgridpage(<?php echo $page?>,'OVERLAY')"><?php echo $page?></a>
                            <?php else:?>
                            <a class="pgnumber" onclick="loadgridpage(<?php echo $page?>,'OVERLAY')"><?php echo $page?></a>
                            <?php endif ?>
                        </div>
                    <?php endforeach ?>
                    <?php if ($page!=$griddetail->getLastpage() && $flgLast!=false):?>
                        <div class="pagination">
                            ..
                        </div>
                        <div class="pagination">
                            <a class="pgnumber" onclick="loadgridpage(<?php echo $griddetail->getLastPage()?>,'OVERLAY')"><?php echo$griddetail->getLastPage()?></a>
                        </div>
                    <?php endif ?>
                    <?php if ($griddetail->getPage()!=$griddetail->getLastpage()):?>
                        <div class="pagination">
                            <a class="pgnumber"  onclick="loadgridpage(<?php echo $griddetail->getNextPage() ?>,'OVERLAY')">Next</a>
                        </div>
                    <?php endif ?>
                        </div>
            <?php endif?>





<?php else:echo "No data found"; endif ?>